package com.springinaction.knights.ioc.demo02;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * 使用注解配置Bean完成依赖注入
 */
public class KnightMain {

    public static void main(String[] args) {
        ApplicationContext context = new AnnotationConfigApplicationContext(KnightConfig.class);
        Knight knight = (Knight) context.getBean("knight");
        knight.embarkOnQuest();
    }
}
